class Enum {
  constructor (value, description, customFields) {
    this.value = value
    this.desc = description

    if (customFields !== undefined) {
      Object.entries(customFields).forEach(entry => {
        this[entry[0]] = entry[1]
      })
    }
  }
}
import _ from 'lodash'
import MAINTENANCE from './maintenance'
import INVENTORY from './inventory'
export const enums = {
  // 云平台跳转权限枚举
  SUBSYSTEM_PRIVILEGES: {
    DLP: new Enum(0, 'DLP'),
    BMS: new Enum(1, 'BMS'),
    SRM: new Enum(2, 'SRM'),
    MES_LITE: new Enum(3, 'MES_LITE')
  },
  //  消息设置页面 推送方式枚举
  SEND_WAY: {
    SEND_WAY_APP: new Enum(0, 'APP'),
    SEND_WAY_WEIXIN: new Enum(1, '微信')
    // SEND_WAY_SHORT_MSG: new Enum(2, '短信'),
    // SEND_WAY_EMAIL: new Enum(3, '邮箱')
  },
  // 子系统列表
  SUBSYSTEM: {
    BMS: new Enum(0, 'DLP后台管理系统', { finish: true }),
    CLOUD: new Enum(1, '语祯云工管理系统', { finish: true }),
    MES_LITE: new Enum(2, 'Mes-lite后台管理系统', { finish: false }),
    SRM: new Enum(3, 'SRM后台管理系统', { finish: false })
  },
  // 工单操作类型
  WORK_ORDER_OPERATIONS: {
    CREATE: new Enum(0, '新建'),
    START: new Enum(1, '开工'),
    CHECKIN: new Enum(2, '报工'),
    FORCE_COMPLETE: new Enum(3, '强制完工'),
    CHANGEOVER: new Enum(4, '换线'),
    TRANSFER: new Enum(5, '转移'),
    CORRECT_COMPLETE_COUNT: new Enum(6, '修正产量'),
    CLOSE: new Enum(7, '关闭'),
    FORCE_CLOSE: new Enum(8, '强制关闭'),
    DELETE: new Enum(9, '删除'),
    QUALITY_TEST: new Enum(10, '报检'),
    WITHDRAW: new Enum(11, '打回'),
    SUSPEND: new Enum(12, '暂停'),
    RESTORE: new Enum(13, '恢复'),
    FILL_IN_OVERPRODUCE: new Enum(14, '填报超产')
  },
  // 业务状态
  BUSINESS_STATUS: {
    NEW_CREATE: new Enum(0, '新建',
      { color: '#5f77fd', plantPlan: true, processPlan: true, workOrder: true, quality: true }),
    BREAK_DOWN: new Enum(1, '分解',
      { color: '#f7b82d', plantPlan: true, processPlan: false, workOrder: false, quality: false }),
    DISPATCH: new Enum(2, '派工',
      { color: '#2bd0f7', plantPlan: false, processPlan: true, workOrder: false, quality: false }),
    CHANGE_LINES: new Enum(4, '换线',
      { color: '#ac70f2', plantPlan: false, processPlan: false, workOrder: true, quality: false }),
    START: new Enum(3, '开工',
      { color: '#18d77f', plantPlan: true, processPlan: true, workOrder: true, quality: false }),
    COMPLETE: new Enum(5, '完工',
      { color: '#ff8559', plantPlan: true, processPlan: true, workOrder: true, quality: false }),
    CLOSE: new Enum(10, '关闭',
      { color: '#999999', plantPlan: true, processPlan: true, workOrder: true, quality: true }),
    FREEZE: new Enum(11, '冻结',
      { color: '#333333', plantPlan: false, processPlan: true, workOrder: false, quality: false }),
    SUSPEND: new Enum(13, '暂停',
      { color: '#E43434', plantPlan: false, processPlan: false, workOrder: true, quality: false })
    // 此状态只用于查询
  },
  // 车间计划、工序计划、工单优先级枚举
  PRIORITY: {
    LOWEST: new Enum(0, '正常', { color: '#18d77f' }),
    HIGHEST: new Enum(1, '紧急', { color: '#e43434' })
  },
  // 生产计划优先级枚举
  PRIORITY_WORKSHOP: {
    LOWEST: new Enum(0, '正常'),
    HIGHEST_1: new Enum(1, '紧急一级', { color: '#e43434' }),
    HIGHEST_2: new Enum(2, '紧急二级', { color: '#e43434' }),
    HIGHEST_3: new Enum(3, '紧急三级', { color: '#e43434' }),
    HIGHEST_4: new Enum(4, '紧急四级', { color: '#e43434' }),
    HIGHEST_5: new Enum(5, '紧急五级', { color: '#e43434' })
  },
  // 生产计划详情状态枚举
  PLAN_STATUS: {
    CREATED: new Enum(0, '新建', { color: '#6278fb' }),
    SPLIT: new Enum(1, '分解', { color: '#f7b82d' }),
    DISPATCHED: new Enum(2, '派工', { color: '#2bd0f7' }),
    STARTED: new Enum(3, '开工', { color: '#18d77f' }),
    CHANGEOVER: new Enum(4, '换线', { color: '#ac70f2' }),
    COMPLETE: new Enum(5, '完工', { color: '#FF8559' }),
    CLOSED: new Enum(10, '关闭', { color: '#999999' }),
    FROZEN: new Enum(11, '冻结', { color: '#333333' }),
    SUSPEND: new Enum(13, '暂停',
      { color: '#E43434', plantPlan: false, processPlan: false, workOrder: true, quality: false })
    // 此状态只用于查询
  },
  // 机床状态枚举
  MACHINES_STATUS: {
    MACHINING: new Enum(1, '运行', { color: '#18D77F' }),
    HALTING: new Enum(0, '停机', { color: '#FF8559' }),
    DISCONNECTING: new Enum(3, '断开', { color: '#999999' }),
    OFFLINE: new Enum(2, '离线', { color: '#666666' }),
    WARNING: new Enum(4, '报警', { color: '#E43434' }),
    CHANGEOVER: new Enum(5, '换线', { color: '#AC70F2' }),
    BREAKDOWN: new Enum(6, '故障', { color: '#F7B82D' }),
    REPAIR: new Enum(7, '维修', { color: '#2bd0f7' })
  },
  // 作业状态枚举
  UPDATE_STATUS: {
    SUCCESS: new Enum(1, '成功', { color: '#18D77F' }),
    FAIL: new Enum(2, '失败', { color: '#E43434' })
  },
  // 作业状态枚举
  PROCESS_STATUS: {
    NORMAL: new Enum(1, '正常作业'),
    BACKWARD: new Enum(2, '稍微落后'),
    FALLVEHIND: new Enum(3, '严重落后'),
    NA: new Enum(4, '暂未派工')
  },
  // 超产状态
  OVER_PRODUCTION_STATUS: {
    NOT_ACK: new Enum(0, '未确认', { color: '#5F77FD' }),
    PARTIAL_ACK: new Enum(1, '部分确认', { color: '#18D77F' }),
    ACK: new Enum(2, '已确认', { color: '#FF8559' })
  },
  // 设备维修枚举
  DEVICE_REPAIR_STATUS: {
    WAITING_LIST: new Enum(1, '待接单', { color: '#5F77FD' }),
    WAITING_REPAIR: new Enum(2, '待维修', { color: '#F7B82D' }),
    REPAIRING: new Enum(3, '维修中', { color: '#2bd0f7' }),
    DEVICE_REPAIR_FINISH: new Enum(4, '已完成', { color: '#999999' }),
    SUSPEND: new Enum(5, '暂停', { color: '#E43434' })
  },
  // 维修记录枚举
  REPAIR_LOG: {
    WAITTING_REPAIR: new Enum(0, '未结束'),
    NO_REPAIR: new Enum(1, '未开始维修拒单'),
    REPAIR_NOT_FINISH: new Enum(2, '已维修打回'),
    REPAIR_FINISH: new Enum(3, '维修完成')
  },
  // 委外申请枚举
  OUTSOURC_STATUS: {
    WAITING_REVIEW: new Enum(0, '待审核', { color: '#5F77FD' }),
    UNDER_REVIEW: new Enum(1, '审核中', { color: '#18D77F' }),
    REVIEWED: new Enum(2, '已审核', { color: '#F7B82D' }),
    // UNREVIEWED: new Enum(3, '未通过', { color: '#F7B82D' }),
    REJECT: new Enum(4, '驳回', { color: '#E43434' })
  },
  // 刀具状态枚举
  CUTTER_STATUS: {
    NOT_LOADED: new Enum(0, '未装载', { color: '#999999' }),
    LOADED: new Enum(1, '已装载', { color: '#5F77FD' })
  },
  // 刀具状态枚举
  CUTTER_TYPE_STATUS: {
    New: new Enum(1, '新建', { color: '#5F77FD' }),
    STOCK_IN: new Enum(2, '在库', { color: '#18D77F' }),
    LEND: new Enum(3, '借出', { color: '#F7B82D' }),
    SCRAP: new Enum(4, '报废', { color: '#999999' })
  },
  // 刀具使用状态枚举
  CUTTER_USE_STATUS: {
    /** 待使用 */
    CUTTER_WAITING: new Enum(1, '在用'),
    /** 报废 */
    CUTTER_USING: new Enum(2, '报废')
  },
  // 质检状态枚举
  CUTTER_INSPECT_STATUS: {
    // 未检验
    CUTTER_NOT_TEST: new Enum(0, '未检验', { color: '#5F77FD' }),
    // 检验中
    CUTTER_UNDER_INSPECTION: new Enum(1, '检验中', { color: '#18D77F' }),
    // 已检验
    CUTTER_INSPECTED: new Enum(2, '已检验', { color: '#FF8559' })
  },
  // 单据状态
  CUTTER_ALLOCATION_STATUS: {
    // 新建
    CUTTER_NEW: new Enum(0, '新建', { color: '#5F77FD' }),
    // 部分入库
    CUTTER_PARTIAL: new Enum(1, '部分入库', { color: '#18D77F' }),
    // 已入库
    CUTTER_STORED: new Enum(2, '已入库', { color: '#FF8559' })
  },
  // 加工领刀状态
  CUTTER_PROCESS_TOOL_STATUS: {
    // 未归还
    CUTTER_NOT_RETURN: new Enum(0, '未归还', { color: '#5F77FD' }),
    // 部分归还
    CUTTER_PARTIAL_RETURN: new Enum(1, '部分归还', { color: '#18D77F' }),
    // 已归还
    CUTTER_RETURN: new Enum(2, '已归还', { color: '#FF8559' })
  },
  // 机床状态枚举  KG 开工 TG 停工 ZZ 报工终止 ZC 正常完工
  SC_ORDER_STATUS: {
    MACHINING: new Enum('KG', '开工', { color: '#18D77F' }),
    HALTING: new Enum('ZC', '完工', { color: '#FF8559' }),
    DISCONNECTING: new Enum('ZZ', '终止', { color: '#999999' }),
    WARNING: new Enum('TG', '停工', { color: '#E43434' })
  },
  // 领刀方式
  CUTTER_CLAIMWAY_STATUS: {
    // 刀单领刀
    CUTTER_SINGLE_COLLAR: new Enum(0, '刀单领刀'),
    // 直接领刀
    CUTTER_DIRECT_LEAD: new Enum(1, '直接领刀')
  },
  // 刀具预警方式
  CUTTER_LIFE_TYPE: {
    CUTTER_LIFE_TIME: new Enum(1, '计时'),
    CUTTER_LIFE_NUMBER: new Enum(2, '计次'),
    CUTTER_LIFE_NONE: new Enum(3, '无')
  },
  // 模具预警方式
  MODE_LIFE_TYPE: {
    CUTTER_LIFE_NUMBER: new Enum(1, '计次'),
    CUTTER_LIFE_NONE: new Enum(2, '无')
  },
  BEI_JIAN_OPTIONS: {
    CAI_GOU: new Enum('采购入库', '采购入库'),
    FAN_XIU: new Enum('返修入库', '返修入库'),
    GUI_HUAN: new Enum('归还入库', '归还入库'),
    PAN_YING: new Enum('盘盈入库', '盘盈入库'),
    OTHER: new Enum('其他入库', '其他入库')
  },
  BEI_OUT_OPTIONS: {
    BAO_FEI: new Enum('报废出库', '报废出库'),
    OTHER: new Enum('其他出库', '其他出库'),
    PAN_KUI: new Enum('盘亏出库', '盘亏出库')
  },
  BEI_OPTIONS: {
    JIN: new Enum(1, '入库'),
    OUT: new Enum(2, '出库')
  },
  // 租户类型
  USER_CATEGORY: {
    MTB: new Enum(1, 'MTB', { color: '#FF8559' }),
    EU: new Enum(2, 'EU', { color: '#AC70F2' }),
    NORMAL: new Enum(3, 'NORMAL', { color: '#18D77F' })
  },
  // // 系统业务权限(pc端)
  SYS_BUSINESS_PERMISSIONS_PC: {
    READ_ALL_WORK_ORDERS: new Enum(0, '全部'),
    READ_OWNED_WORK_ORDERS: new Enum(1, '个人'),
    READ_ALL_QC_ORDERS: new Enum(2, '全部'),
    READ_OWNED_QC_ORDERS: new Enum(3, '个人'),
    READ_ALL_G_CODE: new Enum(4, '全部'),
    READ_OWNED_G_CODE: new Enum(5, '个人'),
    READ_ALL_MAINTENANCE: new Enum(6, '全部'),
    READ_OWNED_MAINTENANCE: new Enum(7, '个人'),
    READ_ALL_APPLY_REPAIR: new Enum(8, '全部'),
    READ_OWNED_APPLY_REPAIR: new Enum(9, '个人'),
    READ_ALL_REPAIR: new Enum(10, '全部'),
    READ_OWNED_REPAIR: new Enum(11, '个人'),
    READ_ALL_OUTSOURCING: new Enum(12, '全部'),
    READ_OWNED_OUTSOURCING: new Enum(13, '个人'),
    // 刀具审核列表读取
    READ_ALL_CUTTER_APPROVAL_LIST: new Enum(14, '全部'),
    READ_OWNED_CUTTER_APPROVAL_LIST: new Enum(15, '个人'),
    // 库存领用申请
    READ_ALL_STOCK_APPLY_LIST: new Enum(16, '全部'),
    READ_OWNED_STOCK_APPLY_LIST: new Enum(17, '个人'),
    // 工具监控
    READ_ALL_STOCK_WORKSHOP_LIST: new Enum(18, '全部'),
    READ_OWNED_STOCK_WORKSHOP_LIST: new Enum(19, '个人')
  },
  // // 系统业务权限(mobile端)
  SYS_BUSINESS_PERMISSIONS_MOBILE: {
    READ_ALL_WORK_ORDERS: new Enum(0, '全部'),
    READ_OWNED_WORK_ORDERS: new Enum(1, '个人'),
    READ_ALL_QC_ORDERS: new Enum(2, '全部'),
    READ_OWNED_QC_ORDERS: new Enum(3, '个人'),
    READ_ALL_MAINTENANCE: new Enum(6, '全部'),
    READ_OWNED_MAINTENANCE: new Enum(7, '个人'),
    READ_ALL_APPLY_REPAIR: new Enum(8, '全部'),
    READ_OWNED_APPLY_REPAIR: new Enum(9, '个人'),
    READ_ALL_REPAIR: new Enum(10, '全部'),
    READ_OWNED_REPAIR: new Enum(11, '个人'),
    READ_ALL_OUTSOURCING: new Enum(12, '全部'),
    READ_OWNED_OUTSOURCING: new Enum(13, '个人')
  },

  // 系统视图权限枚举(pc端，目前最大id：183)
  SYS_PERMISSION: {
    SYS_MENU: new Enum(0, '基础数据',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'system' }),
    DICT_PAGE: new Enum(4, '数据字典',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'dataDict' }),
    REASON_PAGE: new Enum(5, '原因字典',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'reason' }),
    DEFECTIVENESS_REASON_TAB: new Enum(6, '零件不良原因',
      { type: 'TAB', parentId: 5, parentName: '原因字典' }),
    // CONCESSION_REASON_TAB: new Enum(7, '让步原因',
    //   { type: 'TAB', parentId: 5, parentName: '原因字典' }),
    // STOP_REASON_TAB: new Enum(8, '停机原因',
    //   { type: 'TAB', parentId: 5, parentName: '原因字典' }),
    SCHEME_PAGE: new Enum(10, '工厂模型',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'organizeStructure' }),
    WORK_CENTER_PAGE: new Enum(11, '工位管理',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'stationMana' }),
    DEVICE_PAGE: new Enum(20, '设备台账',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'equipmentRecord' }),
    ADD_DEVICE_BTN: new Enum(21, '添加',
      { type: 'BUTTON', parentId: 20, parentName: '设备台账' }),
    EDIT_DEVICE_BTN: new Enum(22, '编辑',
      { type: 'BUTTON', parentId: 20, parentName: '设备台账' }),
    DEL_DEVICE_BTN: new Enum(23, '删除',
      { type: 'BUTTON', parentId: 20, parentName: '设备台账' }),
    IMPORT_DEVICE_BTN: new Enum(24, '下载/导入',
      { type: 'BUTTON', parentId: 20, parentName: '设备台账' }),
    PRINT_DEVICE_QR_CODE_BTN: new Enum(25, '打印二维码',
      { type: 'BUTTON', parentId: 20, parentName: '设备台账' }),
    // USER_PAGE: new Enum(3, '人员管理',
    //   { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'userMana' }),
    USER_MENU: new Enum(3, '用户管理',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'userMenu' }),
    // ADD_USER_BTN: new Enum(170, '添加用户',
    //   { type: 'BUTTON', parentId: 3, parentName: '人员管理' }),
    // DELETE_USER_BTN: new Enum(171, '批量删除',
    //   { type: 'BUTTON', parentId: 3, parentName: '人员管理' }),
    // DEPART_PAGE: new Enum(12, '部门列表',
    //   { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'departList' }),
    CALENDAR_PAGE: new Enum(13, '工厂日历',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'factoryCalendar' }),
    SHIFT_TAB: new Enum(14, '班制管理',
      { type: 'TAB', parentId: 13, parentName: '工厂日历' }),
    SCHEDULING_TAB: new Enum(15, '班组排班',
      { type: 'TAB', parentId: 13, parentName: '工厂日历' }),
    // 141
    // WAREHOUSE: new Enum(141, '仓库维护',
    //   { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'warehouse' }),
    // STORAGE_LOCATION: new Enum(142, '库位维护',
    //   { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'storageLocation' }),
    MACHINE_BINDING_PAGE: new Enum(54, '人机绑定',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'manMachineBind' }),
    TECHNICIAN_BINDING_BTN: new Enum(55, '技术员绑定/替换',
      { type: 'BUTTON', parentId: 54, parentName: '人机绑定' }),
    OPERATOR_BINDING_BTN: new Enum(56, '操作员绑定/替换',
      { type: 'BUTTON', parentId: 54, parentName: '人机绑定' }),
    FIXED_SCHEDULING: new Enum(129, '固定调度线',
      { type: 'PAGE', parentId: 0, parentName: '基础数据', name: 'fixed-scheduling' }),
    MACHINE_LAYOUT_PAGE: new Enum(143, '设备布局',
      { type: 'PAGE', parentId: 0, parentName: '系统设置', name: 'machineLayout' }),
    STATUS_MENU: new Enum(74, '状态监控',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'status' }),
    STATUS_MACHINE_STATISTICS_V3_PAGE: new Enum(96, '状态总览',
      { type: 'PAGE', parentId: 74, parentName: '状态监控', name: 'statusOverview' }),
    STATUS_MACHINE_V3_PAGE: new Enum(94, '机台列表',
      { type: 'PAGE', parentId: 74, parentName: '状态监控', name: 'statsMonitor' }),
    STATUS_MACHINE_MACHINESTAT_PAGE: new Enum(83, '机台统计记录',
      { type: 'PAGE', parentId: 74, parentName: '状态监控', name: 'machineStat' }),
    STATUS_MACHINE_ENERGY_BTN: new Enum(831, '能耗循环明细',
      { type: 'BUTTON', parentId: 83, parentName: '状态监控', name: 'energyStat' }),
    STATUS_MACHINE_CAMERA_CONFIG: new Enum(152, '状态参数配置',
      { type: 'PAGE', parentId: 74, parentName: '状态监控', name: 'cameraConfig' }),

    // g 代码  中， 新建 924， 删除923 上传文件921 下载文件922
    PROGRAM_MENU: new Enum(16, 'DNC',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'program' }),
    FILETRANSFER: new Enum(93, '文件传输',
      { type: 'PAGE', parentId: 16, parentName: 'DNC', name: 'programTransfer' }),
    G_GOV_PAGE: new Enum(92, 'G代码管理',
      { type: 'PAGE', parentId: 16, parentName: 'DNC', name: 'gGov' }),
    G_UPLOAD_BTN: new Enum(921, '上传文件',
      { type: 'BUTTON', parentId: 92, parentName: 'gGov' }),
    G_DOWN_BTN: new Enum(922, '下载文件',
      { type: 'BUTTON', parentId: 92, parentName: 'gGov' }),
    G_DELETE_BTN: new Enum(923, '删除',
      { type: 'BUTTON', parentId: 92, parentName: 'gGov' }),
    G_ADD_BTN: new Enum(924, '新建',
      { type: 'BUTTON', parentId: 92, parentName: 'gGov' }),
    G_PAIR_BTN: new Enum(175, '标记设置',
      { type: 'BUTTON', parentId: 16, parentName: 'DNC' }),
    ONLINEPROCESS2: new Enum(105, '在线加工',
      { type: 'PAGE', parentId: 16, parentName: 'DNC', name: 'onlineProcess' }),

    CRAFT_MENU: new Enum(26, '生产执行',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'craft' }),
    PRODUCT_STANDARD: new Enum(178, '产品规格',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'productStandard' }),
    PRODUCT_PAGE: new Enum(27, '产品定义',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'productDefine' }),
    ADD_PRODUCT_BTN: new Enum(28, '添加产品',
      { type: 'BUTTON', parentId: 27, parentName: '产品定义' }),
    IMPORT_PRODUCT_BTN: new Enum(29, '下载/导入',
      { type: 'BUTTON', parentId: 27, parentName: '产品定义' }),
    EDIT_PRODUCT_BTN: new Enum(30, '编辑',
      { type: 'BUTTON', parentId: 27, parentName: '产品定义' }),
    DEL_PRODUCT_BTN: new Enum(31, '删除',
      { type: 'BUTTON', parentId: 27, parentName: '产品定义' }),
    PROCESS_PAGE: new Enum(32, '工序定义',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'processDefine' }),
    ADD_PROCESS_BTN: new Enum(33, '添加工序',
      { type: 'BUTTON', parentId: 32, parentName: '工序定义' }),
    IMPORT_PROCESS_BTN: new Enum(34, '下载/导入',
      { type: 'BUTTON', parentId: 32, parentName: '工序定义' }),
    EDIT_PROCESS_BTN: new Enum(35, '编辑',
      { type: 'BUTTON', parentId: 32, parentName: '工序定义' }),
    DEL_PROCESS_BTN: new Enum(36, '删除',
      { type: 'BUTTON', parentId: 32, parentName: '工序定义' }),
    CRAFT_PAGE: new Enum(37, '工艺管理',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'craftCenter' }),
    ADD_CRAFT_BTN: new Enum(38, '路线添加',
      { type: 'BUTTON', parentId: 37, parentName: '工艺管理' }),
    EDIT_CRAFT_BTN: new Enum(39, '编辑',
      { type: 'BUTTON', parentId: 37, parentName: '工艺管理' }),
    DEL_CRAFT_BTN: new Enum(40, '删除',
      { type: 'BUTTON', parentId: 37, parentName: '工艺管理' }),
    MRP: new Enum(177, '物料管理',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'MRP' }),
    MACHINE_HOUR_PAGE: new Enum(41, '工时定额',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'hourNorm' }),
    WORKSHOP_PLAN_PAGE: new Enum(43, '生产计划',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'plantPlan' }),
    ADD_WORKSHOP_PLAN_BTN: new Enum(44, '新建',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    IMPORT_WORKSHOP_PLAN_BTN: new Enum(45, '下载/导入',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    SPLIT_WORKSHOP_PLAN_BTN: new Enum(46, '计划分解/解除',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    FREEZE_WORKSHOP_PLAN_BTN: new Enum(47, '冻结/解冻',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    LOCK_WORKSHOP_PLAN_BTN: new Enum(48, '锁定/解锁',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    DEL_WORKSHOP_PLAN_BTN: new Enum(49, '删除',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    EDIT_WORKSHOP_PLAN_BTN: new Enum(50, '编辑',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    ADJUST_PROCESS_PLAN_BTN: new Enum(51, '工序计划调整',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    FORCE_CLOSE_BTN: new Enum(95, '强制关闭',
      { type: 'BUTTON', parentId: 43, parentName: '生产计划' }),
    PRODUCTION_DISPATCH: new Enum(76, '计划派工',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'productionDispatch' }),
    PLAN_SCHEDULE_PAGE: new Enum(71, '计划进度',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'planProgress' }),

    WORK_ORDER_PAGE: new Enum(57, '加工工单',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'processOrder' }),
    START_CHECKIN_WORK_ORDER_BTN: new Enum(58, '换线/开工/报工',
      { type: 'BUTTON', parentId: 57, parentName: '加工工单' }),
    REQUIRE_QC_INSPECTION_BTN: new Enum(59, '报检',
      { type: 'BUTTON', parentId: 57, parentName: '加工工单' }),
    CLOSE_WORK_ORDER_BTN: new Enum(60, '关闭工单（转序）',
      { type: 'BUTTON', parentId: 57, parentName: '加工工单' }),
    TRANSFER_WORK_ORDER_BTN: new Enum(61, '工单转移',
      { type: 'BUTTON', parentId: 57, parentName: '加工工单' }),
    TRANSFER_WORK_BACK_BTN: new Enum(82, '工单打回',
      { type: 'BUTTON', parentId: 57, parentName: '加工工单' }),
    CORRECT_WORK_ORDER_COMPLETE_COUNT_BTN: new Enum(62, '修正产量',
      { type: 'BUTTON', parentId: 57, parentName: '加工工单' }),
    FORCE_CLOSE_WORK_ORDER_BTN: new Enum(63, '强制完工/关闭',
      { type: 'BUTTON', parentId: 57, parentName: '加工工单' }),
    QC_ORDER_PAGE: new Enum(64, '质检工单',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'qualityOrder' }),
    // QC_ORDER_PAGE_V2: new Enum(64, '质检工单V2',
    //   { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'qualityOrderV2' }),
    ADD_BAD_NUM_BTN: new Enum(86, '不良数量增加',
      { type: 'BUTTON', parentId: 64, parentName: '质检工单' }),
    EDIT_BAD_NUM_BTN: new Enum(87, '不良数量编辑',
      { type: 'BUTTON', parentId: 64, parentName: '质检工单' }),
    DEL_BAD_NUM_BTN: new Enum(88, '不良数量删除',
      { type: 'BUTTON', parentId: 64, parentName: '质检工单' }),
    // ADD_COMPROMISE_NUM_BTN: new Enum(89, '让步数量增加',
    //   { type: 'BUTTON', parentId: 64, parentName: '质检工单' }),
    // EDIT_COMPROMISE_NUM_BTN: new Enum(90, '让步数量编辑',
    //   { type: 'BUTTON', parentId: 64, parentName: '质检工单' }),
    // DEL_COMPROMISE_NUM_BTN: new Enum(91, '让步数量删除',
    //   { type: 'BUTTON', parentId: 64, parentName: '质检工单' }),
    INPUT_BAD_NUM_BTN: new Enum(104, '质检录入',
      { type: 'BUTTON', parentId: 64, parentName: '质检工单' }),
    PERFORMANCE_PAGE: new Enum(81, '人员绩效',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'performance' }),
    PRODUCTION_REPORT: new Enum(174, '产量报表',
      { type: 'PAGE', parentId: 26, parentName: '生产执行', name: 'productionReport' }),

    WORK_MENU: new Enum(53, '设备保全',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'repair' }),
    APPLY_REPAIR_PAGE: new Enum(148, '维修申请',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'applyRepair' }),
    FiX_PAGE: new Enum(97, '维修工单',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'repairList' }),
    APPLY_OUTSOURCING_PAGE: new Enum(149, '委外申请',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'applyOutsourcing' }),
    REPAIR_RECORDS_PAGE: new Enum(150, '维修记录',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'repairRecords' }),
    // FiX_DETAIL_PAGE: new Enum(98, '维修履历',
    //   { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'repairLogs' }),
    MAINTENANCE_ITEM_PAGE: new Enum(144, '保养项目',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'maintenanceItem' }),
    MAINTENANCE_PLAN_PAGE: new Enum(145, '保养计划',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'maintenancePlan' }),
    MAINTENANCE_ORDER_PAGE: new Enum(146, '保养工单',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'maintenanceOrder' }),
    SUPPLEMENTARY_RECORD_BTN: new Enum(173, '补录',
      { type: 'BUTTON', parentId: 146, parentName: '保养工单' }),
    MAINTENANCE_RECORD_PAGE: new Enum(147, '保养记录',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'maintenanceRecord' }),
    SPARE_PARTS_PAGE: new Enum(180, '备件品类',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'spareParts' }),
    PARTS_LIST_PAGE: new Enum(200, '设备备件清单',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'partsList' }),
    SPARE_APPLY_PAGE: new Enum(201, '领用申请',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'spareApply' }),
    MAINTENANCE_STATISTICS_PAGE: new Enum(204, '维修统计',
      { type: 'PAGE', parentId: 53, parentName: '设备保全', name: 'maintenanceStatistics' }),

    INVENTORY_MENU: new Enum(75, '库存管理',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'inventory' }),
    STOCK_OVERVIEW_PAGE: new Enum(153, '库存概览',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'stockOverview' }),
    STOCK_INQUIRY_PAGE: new Enum(154, '库存查询',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'stockInquiry' }),
    STOCK_DETAIL_PAGE: new Enum(179, '出入库明细',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'stockDetail' }),
    STOCK_IN_PAGE: new Enum(155, '库存入库',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'stockIn' }),
    STOCK_OUT_PAGE: new Enum(156, '库存出库',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'stockOut' }),
    // APPLY_USE_PAGE: new Enum(157, '领用申请',
    //   { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'applyUse' }),
    INVENTORY_RECEIVE_PAGE: new Enum(158, '领用出库',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'receive' }),
    INVENTORY_REVERT_PAGE: new Enum(159, '借出归还',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'revert' }),
    INVENTORY_SETTING_PAGE: new Enum(160, '仓库设置',
      { type: 'PAGE', parentId: 75, parentName: '库存管理', name: 'inventorySetting' }),

    CUTTER_MENU: new Enum(100, '刀具管理',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'cutter' }),
    CUTTER_DICTIONARY_PAGE: new Enum(101, '刀具型号',
      { type: 'PAGE', parentId: 100, parentName: '刀具管理', name: 'dictionary' }),
    CUTTER_CODE_PAGE: new Enum(102, '刀具台账',
      { type: 'PAGE', parentId: 100, parentName: '刀具管理', name: 'identifyingCode' }),
    CUTTER_TOOLREVIEW_PAGE: new Enum(161, '刀具审核',
      { type: 'PAGE', parentId: 100, parentName: '刀具管理', name: 'toolReview' }),
    // 130 - 137
    CUTTER_ELECTRONICTOOL_PAGE: new Enum(135, '电子刀单',
      { type: 'PAGE', parentId: 100, parentName: '刀具管理', name: 'electronicTool' }),
    CUTTER_MONITOR_PAGE: new Enum(103, '在用刀具寿命',
      { type: 'PAGE', parentId: 100, parentName: '刀具管理', name: 'lifeMonitor' }),
    CUTTER_SCRAP: new Enum(139, '刀具报废记录',
      { type: 'PAGE', parentId: 100, parentName: '刀具管理', name: 'cutterScrap' }),
    CUTTER_APPLY: new Enum(202, '刀具领用申请',
      { type: 'PAGE', parentId: 100, parentName: '刀具管理', name: 'cutterApply' }),

    // 工具管理
    TOOLMANAGEMENT_MENU: new Enum(164, '工具管理',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'toolManagement' }),
    TOOLMODEL_PAGE: new Enum(165, '工具型号',
      { type: 'PAGE', parentId: 164, parentName: '工具管理', name: 'toolModel' }),
    TOOLACCOUNT_PAGE: new Enum(166, '工具台账',
      { type: 'PAGE', parentId: 164, parentName: '工具管理', name: 'toolAccount' }),
    // TOOLEXAMINE_PAGE: new Enum(167, '工具审核',
    //   { type: 'PAGE', parentId: 164, parentName: '工具管理', name: 'toolExamine' }),
    TOOLMONITORING_PAGE: new Enum(168, '模具监控',
      { type: 'PAGE', parentId: 164, parentName: '工具管理', name: 'toolMonitoring' }),
    // TOOLLIST_PAGE: new Enum(169, '电子工具单',
    //   { type: 'PAGE', parentId: 164, parentName: '工具管理', name: 'toolList' }),
    TOOLRECORD_PAGE: new Enum(172, '工具报废统计记录',
      { type: 'PAGE', parentId: 164, parentName: '工具管理', name: 'toolRecord' }),
    TOOLAPPLY_PAGE: new Enum(203, '工具领用申请',
      { type: 'PAGE', parentId: 164, parentName: '工具管理', name: 'toolApply' }),

    STATISTICS_MENU: new Enum(77, '报表中心',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'statistics' }),
    STOP_REASON_PAGE: new Enum(78, '停机原因分析',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'stopReason' }),
    DEVICE_RATE_PAGE: new Enum(79, '设备稼动率',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'deviceRate' }),
    DISQUALIFIED_REASON_PAGE: new Enum(80, '不良原因分析',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'disqualifiedReason' }),
    DAILY_FLOW: new Enum(151, '日流水报表',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'dailyFlow' }),
    PRODUCT_STAT_PAGE: new Enum(85, '订单报表',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'productStat' }),
    CHANGE_LINE_ANALYSIS: new Enum(162, '换线分析统计',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'changeLineAnalysis' }),
    TOOL_USAGE_REPORT: new Enum(176, '刀具使用报表',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'toolUsageReport' }),
    SC_ORDER_REPORT: new Enum(183, '工单报表',
      { type: 'PAGE', parentId: 77, parentName: '报表中心', name: 'scOrderReport' }),
    // CUSTOM_REPORT: new Enum(99, '自定义报表',
    //   { type: 'PAGE', parentId: 77, parentName: '报表分析', name: 'customReport' }),
    // 138 - 140
    // QUALITY_COMPARISON: new Enum(138, '刀具质量对比',
    //   { type: 'PAGE', parentId: 77, parentName: '报表分析', name: 'qualityComparison' }),
    // CUTTER_PURCHASE: new Enum(140, '刀具采购报表',
    //   { type: 'PAGE', parentId: 77, parentName: '报表分析', name: 'cutterPurchase' }),

    FACTORY_MENU: new Enum(9, '设置管理',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'factory' }),

    // ROLE_PAGE: new Enum(1, '系统角色',
    //   { type: 'PAGE', parentId: 9, parentName: '系统设置', name: 'roleDefine' }),
    // ROLE_MENU_PAGE: new Enum(2, '权限设定',
    //   { type: 'PAGE', parentId: 9, parentName: '系统设置', name: 'roleMenu' }),
    CUSTOMER_SET_PAGE: new Enum(84, '客制化设置',
      { type: 'PAGE', parentId: 9, parentName: '系统设置', name: 'customerSet' }),
    SET_LOGO_PAGE: new Enum(182, 'logo设置',
      { type: 'PAGE', parentId: 9, parentName: '系统设置', name: 'setLogo' }),
    MINE_MESSAGE_PAGE: new Enum(115, '我的消息',
      { type: 'PAGE', parentId: 9, parentName: '系统设置', name: 'mineMessage' }),
    MESSAGE_SET_PAGE: new Enum(114, '消息设置',
      { type: 'PAGE', parentId: 9, parentName: '系统设置', name: 'messageSet' }),
    // INTERFACE_CONFIG_PAGE: new Enum(163, '接口设置',
    //   { type: 'PAGE', parentId: 9, parentName: '系统设置', name: 'interfaceConfig' }),

    // BMS_MENU: new Enum(65, 'BMS',
    //   { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'bms' }),
    // BMS_DICT_PAGE: new Enum(66, 'BMS数据字典',
    //   { type: 'PAGE', parentId: 65, parentName: 'BMS', name: 'bmsDict' }),
    // BMS_COMPANY_LIST_PAGE: new Enum(68, '企业列表',
    //   { type: 'PAGE', parentId: 65, parentName: 'BMS', name: 'companyList' }),
    // BMS_COMPANY_MENU_PAGE: new Enum(69, '企业菜单',
    //   { type: 'PAGE', parentId: 65, parentName: 'BMS', name: 'menuGov' }),
    // BMS_BOX_MANAGEMENT_PAGE: new Enum(70, '盒子管理',
    //   { type: 'PAGE', parentId: 65, parentName: 'BMS', name: 'boxGov' }),

    MIOT_MENU: new Enum(107, '机器联网',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'miot' }),
    // STATUS_MACHINE_PAGE: new Enum(75, '机台状态',
    //   { type: 'PAGE', parentId: 74, parentName: '状态监控', name: 'machine' }),
    MIOT_LIST_PAGE: new Enum(108, '网关列表',
      { type: 'PAGE', parentId: 107, parentName: '机器联网', name: 'miotList' }),
    MIOT_TASK_MANAGE: new Enum(181, '网关任务管理',
      { type: 'PAGE', parentId: 107, parentName: '机器联网', name: 'taskManage' }),

    EMS_MENU: new Enum(120, '售后服务',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'ems' }),
    EMS_CUSTOMER_MANAGEMENT_PAGE: new Enum(121, '客户管理',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'customerManagement' }),
    EMS_MODEL_MANAGEMENT_PAGE: new Enum(122, '机型管理',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'modelManagement' }),
    EMS_EQUIPMENT_LIST_PAGE: new Enum(123, '设备列表',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'equipmentList' }),
    EMS_MACHINE_DISTRIBUTION_PAGE: new Enum(124, '机床分布图',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'machineDistribution' }),
    EMS_STATUS_MONITORING_PAGE: new Enum(125, 'EMS状态监控',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'statusMonitoring' }),
    EMS_ALARM_STATISTICS_PAGE: new Enum(126, '报警统计',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'alarmStatistics' }),
    EMS_MAINTENANCE_SERVICE_PAGE: new Enum(127, '维保服务',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'maintenanceService' }),
    EMS_ALARM_PUSH_PAGE: new Enum(128, '报警推送设置',
      { type: 'PAGE', parentId: 120, parentName: '售后服务', name: 'alarmPush' }),

    // 能耗管理(外包在枚举前+1)
    ENERGY_MENU: new Enum(1180, '能耗管理',
      { type: 'MENU_LEVEL_ONE', parentId: null, parentName: '/', name: 'energy' }),
    ENERGY_TYPE_PAGE: new Enum(1181, '能源类型管理',
      { type: 'PAGE', parentId: 1180, parentName: '能耗管理', name: 'energyType' }),
    ENERGY_PEAK_VALLEY_PAGE: new Enum(1182, '峰谷定义',
      { type: 'PAGE', parentId: 1180, parentName: '能耗管理', name: 'peakValley' }),
    ENERGY_INSTRUMENTS_PAGE: new Enum(1183, '仪表台账',
      { type: 'PAGE', parentId: 1180, parentName: '能耗管理', name: 'instruments' }),
    ENERGY_RUNTIME_DATA_PAGE: new Enum(1184, '运行数据',
      { type: 'PAGE', parentId: 1180, parentName: '能耗管理', name: 'runtimeData' }),
    ENERGY_ELECTRICITY_PAGE: new Enum(1185, '能耗统计',
      { type: 'PAGE', parentId: 1180, parentName: '能耗管理', name: 'electricity' }),
    ENERGY_ENERGY_REPORT_PAGE: new Enum(1186, '能耗报表',
      { type: 'PAGE', parentId: 1180, parentName: '能耗管理', name: 'energyReport' })
  },

  // 系统权限枚举(mobile端，目前最大id：39)
  SYS_PERMISSIONS_MOBILE: {
    MACHINE_BINDING: new Enum(0, '人机绑定',
      { level: 0, parentId: null, parentName: '/' }),
    OPERATOR_BINDING: new Enum(1, '批量绑定/绑定',
      { level: 1, parentId: 0, parentName: '人机绑定' }),
    WORK_ORDER: new Enum(2, '加工工单',
      { level: 0, parentId: null, parentName: '/' }),
    FORCE_CLOSE_WORK_ORDER: new Enum(3, '强制完工/关闭',
      { level: 1, parentId: 2, parentName: '加工工单' }),
    WORK_ORDER_DETAIL: new Enum(4, '工单详情',
      { level: 1, parentId: 2, parentName: '加工工单' }),
    START_CHECKIN_WORK_ORDER: new Enum(5, '换线/开工/报工',
      { level: 2, parentId: 4, parentName: '工单详情' }),
    REQUIRE_QC_INSPECTION: new Enum(6, '报检',
      { level: 2, parentId: 4, parentName: '工单详情' }),
    CLOSE_WORK_ORDER: new Enum(7, '转序',
      { level: 2, parentId: 4, parentName: '工单详情' }),
    TRANSFER_WORK_ORDER: new Enum(8, '工单打回',
      { level: 2, parentId: 4, parentName: '工单详情' }),
    CORRECT_WORK_ORDER_COMPLETE_COUNT: new Enum(9, '产量修正',
      { level: 2, parentId: 4, parentName: '工单详情' }),
    QC_ORDER: new Enum(10, '质检工单',
      { level: 0, parentId: null, parentName: '/' }),
    QC_ORDER_DETAIL: new Enum(11, '质检工单详情',
      { level: 1, parentId: 10, parentName: '质检工单' }),
    BAD_REPORT: new Enum(13, '质检录入',
      { level: 2, parentId: 11, parentName: '质检工单详情' }),
    ADD_BAD_NUM_BTN: new Enum(19, '不良数量增加',
      { level: 2, parentId: 11, parentName: '质检工单详情' }),
    EDIT_BAD_NUM_BTN: new Enum(20, '不良数量编辑',
      { level: 2, parentId: 11, parentName: '质检工单详情' }),
    DEL_BAD_NUM_BTN: new Enum(21, '不良数量删除',
      { level: 2, parentId: 11, parentName: '质检工单详情' }),
    // ADD_COMPROMISE_NUM_BTN: new Enum(22, '让步数量增加',
    //   { level: 2, parentId: 11, parentName: '质检工单详情' }),
    // EDIT_COMPROMISE_NUM_BTN: new Enum(23, '让步数量编辑',
    //   { level: 2, parentId: 11, parentName: '质检工单详情' }),
    // DEL_COMPROMISE_NUM_BTN: new Enum(24, '让步数量删除',
    //   { level: 2, parentId: 11, parentName: '质检工单详情' }),
    PROCESS_PLAN: new Enum(12, '计划进度',
      { level: 0, parentId: null, parentName: '/' }),
    STATUS_MACHINE: new Enum(14, '机台状态',
      { level: 0, parentId: null, parentName: '/' }),
    TOOL_MANAGEMENT: new Enum(18, '刀具管理',
      { level: 0, parentId: null, parentName: '/' }),
    // MAINTAIN: new Enum(15, '设备维修',
    //   { level: 0, parentId: null, parentName: '/' }),
    APPLY_REPAIR: new Enum(28, '维修申请',
      { level: 0, parentId: null, parentName: '/' }),
    FiX_PAGE: new Enum(29, '维修工单',
      { level: 0, parentId: null, parentName: '/' }),
    APPLY_OUTSOURCING: new Enum(30, '委外申请',
      { level: 0, parentId: null, parentName: '/' }),
    QUALITY_GOV: new Enum(16, '质量管理',
      { level: 0, parentId: null, parentName: '/' }),
    ANDON: new Enum(17, '安灯',
      { level: 0, parentId: null, parentName: '/' }),
    MIOT: new Enum(25, '机器联网',
      { level: 0, parentId: null, parentName: '/' }),
    EMS: new Enum(26, '售后服务',
      { level: 0, parentId: null, parentName: '/' }),
    MAINTENANCE: new Enum(27, '设备保养',
      { level: 0, parentId: null, parentName: '/' }),
    MAINTENANCE_ORDER_PAGE_DETAIL: new Enum(37, '保养工单详情',
      { level: 1, parentId: 27, parentName: '设备保养' }),
    SUPPLEMENTARY_RECORD_BTN: new Enum(38, '补录',
      { level: 2, parentId: 37, parentName: '保养工单详情' }),
    STOP_REPORTING: new Enum(31, '停机填报',
      { level: 0, parentId: null, parentName: '/' }),
    APPLY_USE_PAGE: new Enum(32, '领用申请',
      { level: 0, parentId: null, parentName: '/' }),
    INVENTORY_RECEIVE_PAGE: new Enum(33, '领用出库',
      { level: 0, parentId: null, parentName: '/' }),
    INVENTORY_REVERT_PAGE: new Enum(34, '借出归还',
      { level: 0, parentId: null, parentName: '/' }),
    DNC_PAGE: new Enum(35, '文件传输',
      { level: 0, parentId: null, parentName: '/' }),
    TOOL_PAGE: new Enum(36, '工具管理',
      { level: 0, parentId: null, parentName: '/' })
    // OUTSOURCING: new Enum(15, '委外加工',
    //   { level: 0, parentId: null, parentName: '/' }),
    // INBOUND: new Enum(16, '入库接收',
    //   { level: 0, parentId: null, parentName: '/' }),
    // OUTBOUND: new Enum(17, '出库管理',
    //   { level: 0, parentId: null, parentName: '/' }),
    // TOOL_MANAGEMENT: new Enum(18, '刀具管理',
    //   { level: 0, parentId: null, parentName: '/' })
  },
  // 维保服务状态枚举
  MAINTENANCE_SERVICE_STATUS: {
    IMPLEMENT: new Enum(0, '待执行', { color: '#5F77FD' }),
    EXECUTING: new Enum(1, '执行中', { color: '#18D77F' }),
    FINISHED: new Enum(2, '已完成', { color: '#FF8559' })
  },
  // 维保服务单据来源
  MAINTENANCE_SERVICE_BILL_SOURCE: {
    CUSTOMERREQUEST: new Enum(1, '客户提请'),
    INITIATIVECREATION: new Enum(2, '主动创建')
  },
  // 维保服务单据类别
  MAINTENANCE_SERVICE_CATEGORIES: {
    RETURNVISIT: new Enum(2, '回访'),
    MAINTENANCE: new Enum(1, '维保')
  },
  // 维保服务项目
  MAINTENANCE_SERVICE_PROJECT: {
    CHANGELUBRICATINGOIL: new Enum(0, '更换润滑油'),
    REGULARCLEANING: new Enum(1, '定期清扫'),
    REPLACEMENTOFSPAREPARTS: new Enum(2, '更换备件'),
    SOFTWAREUPGRADE: new Enum(3, '软件升级')
  },
  // 保养枚举
  ...MAINTENANCE,
  // 库存
  ...INVENTORY
}

export function fromValue (enumerations, value) {
  if (!(enumerations instanceof Object)) {
    throw new Error('enumerations 必须是包含 Enum 的对象')
  }

  return Object.values(enumerations).find(o => o.value === value)
}
/**
 * 获取枚举数组,
 * @param {*} enumerations 枚举
 * @param {*} value 键值 传入获取Object
 */
export function getEnum (enumerations, value) {
  if (!(enumerations instanceof Object)) {
    throw new Error('enumerations 必须是包含 Enum 的对象')
  }
  if (!_.isNil(value)) return Object.values(enumerations).find(o => o.value === value)
  const member = Object.entries(enumerations)
    .map(entry => {
      const params = Object.keys(entry[1]).reduce((obj, item) => {
        if (item === 'desc') {
          obj['label'] = _.get(entry[1], 'desc', '')
        } else {
          obj[item] = _.get(entry[1], item, '')
        }
        return obj
      }, {})
      return params
    }).filter(v => v.value !== '')
  return [...member]
}
export default enums

export const getViewPrivilegeId = (name) => { return getEnum(enums.SYS_PERMISSION).find(v => v.name === name).value }
